//#ifndef COIN_H
//#define COIN_H

//#include <QGraphicsItem>
//#include <QPixmap>
//#include "objecttype.h"

//class Coin : public QGraphicsItem
//{

//public:
//    enum { Type = UserType + coinType };
//    Coin(QGraphicsItem *parent = 0);
//    void nextFrame2();
//    QRectF boundingRect() const;
//    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
//    int type() const;

//private:

//    int mCurrentFrame2;
//    QPixmap mPixmap2;

//};

//#endif // COIN_H
#ifndef COIN_H
#define COIN_H

#include <QGraphicsItem>
#include <QPixmap>

class Coin : public QGraphicsItem
{
public:
    enum { Type = UserType + 3 }; // 自定义类型，供碰撞检测使用

    Coin(QGraphicsItem *parent = nullptr);

    QRectF boundingRect() const override; // 碰撞盒
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;

    void nextFrame2(); // 动画切帧
    int type() const override;

private:
    QPixmap mPixmap2;     // 金币帧图
    int mCurrentFrame2;   // 当前帧偏移
};

#endif // COIN_H
